<style lang="less" scoped="scoped">
    @import "contract-entry.less";

    .div-layer {
        position: relative;
    }

    .upimg:hover {
        background: #EB9620;
        text-decoration: none;
    }

    .upimg {
        width: 80px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        background: #EB9620;
        border-radius: 5px;
        color: #FFFFFF;
        position: absolute;
        top: 40%;
        left: 33%;
        transform: translate(-50%, -50%);
    }

    .upimg2 {
        width: 80px;
        height: 30px;
        line-height: 30px;
        text-align: center;
        background: #EB9620;
        border-radius: 5px;
        color: #FFFFFF;
        position: absolute;
        top: 40%;
        left: 62%;
        transform: translate(-50%, -50%);
    }

    .upimg input {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        top: 0;
        bottom: 0;
        height: 100%;
        filter: alpha(opacity=0);
        opacity: 0;
        cursor: pointer;
        overflow: hidden;
    }

    .upimg2 input {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
        top: 0;
        bottom: 0;
        height: 100%;
        filter: alpha(opacity=0);
        opacity: 0;
        cursor: pointer;
        overflow: hidden;
    }

    .showImg i {
        position: absolute;
        right: 0;
        bottom: 0;
    }

    .showImg > li {
        width: 100px;
        height: 100px;
        position: relative;
        border: 1px dotted #ccc;
        margin-left: 100px;
    }

    .showImg > li img {
        width: 100%;
        height: 100%;
    }
    .tree-bar-box {
        position: relative;
        z-index: 100;
        .tree-bar {
            background-color: #fff;
            position: absolute;
            top: 30px;
            border: 1px solid rgb(220, 222, 226);
        }
        .tree-mask {
            display: none;
            position: fixed;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
            z-index: 99;
            &.open {
                display: block;
            }
        }
    }
    .footer{
        position: fixed;
        height: 60px;
        background-color: white;
        bottom: 0;
        left:0;
        right: 0;
        z-index: 99;
    }
    .footer .footer_content{
        max-width: 1600px;
        min-width: 1200px;
        margin: auto;
        height: 100%;
        line-height: 60px;
        padding: 0 16px;
        text-align: right;

    }
    .footer .footer_content>p>button{
        height: 30px;
        font-size: 12px;
        text-align: center;
    }
    .footer .footer_content>p>button.submitBtn{
        margin-left: 10px;
    }
</style>
<style lang="less" scoped>
@import "../../../../assets/css/applyDetail";

.contract-entry .fileOperation {
    padding-top: 8px;
}
</style>
<style lang="less">
    .ivu-tabs-nav-container{
        font-size: 14px;
    }
    .applyDetail .ivu-tabs-nav .ivu-tabs-tab:hover {
        color: #EB9620;
    }
</style>
<template>
    <div class="applyDetail contract-entry">
        <basicinfo v-bind:orderInfo="this.formEntry.orderInfo" :recordDetails="this.formEntry.recordDetails"
                   :isNeedApproval="true"></basicinfo>
        <div class="detail-card" style="margin-top: 16px;">
            <Tabs v-model="openTabs" @on-click="turnToUpload">
                <TabPane label="基本信息" name="baseInfo">
                    <div class="tab">
                        <Form ref="formEntry" :model="formEntry" :rules="formRules" :label-width="160" inline>
                            <Collapse v-model="openPanel" simple>
                                <Panel name="1" v-if="backInfo===1">
                                    <span>退件记录</span>
                                    <div class="panel-content" slot="content">
                                        <Table border :columns="recordColumnsHead"
                                               :data="formEntry.returnRecords"></Table>
                                    </div>
                                </Panel>
                                <Panel name="2">
                                    <span>发票信息</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="放款模式" prop="contractInfo.lendingMode" :required=true>
                                                <Select v-model="formEntry.contractInfo.lendingMode" filterable
                                                        clearable
                                                        @on-change="changelendingMode" :disabled="isDisabled">
                                                    <Option v-for="item in dataDic.lendingMode" :value="item.value"
                                                            :key="item.value" :label="item.title">
                                                        {{ item.title }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem label="开票单位性质" prop="carInvoice.invoiceNature" :required=true
                                                      v-if="showInvoiceNature">
                                                <Select v-model="formEntry.carInvoice.invoiceNature" clearable
                                                        @on-change="changeInvoiceNature" :disabled="isDisabled">
                                                    <Option v-for="item in dataDic.invoiceNature" :value="item.value"
                                                            :key="item.value" :label="item.title">
                                                        {{ item.title }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem v-if="!isViewPerson" label="开票单位" prop="carInvoice.invoiceUnit"
                                                      :rules="{required: true, message: '开票单位不能为空', trigger: 'change'}">
                                                <!--                                        @on-change="searchTree"-->
                                                <Input v-if="this.formEntry.orderInfo.businessType === '02'" type="text"
                                                       v-model="formEntry.carInvoice.invoiceUnit"
                                                       :disabled="isDisabled"/>
                                                <div class="tree-bar-box">

                                                    <Input v-if="this.formEntry.orderInfo.businessType === '01'"
                                                           type="text"
                                                           v-model="formEntry.carInvoice.invoiceUnit"
                                                           :disabled="isDisabled"
                                                           suffix="ios-search"
                                                           placeholder="输入搜索开票单位"
                                                           clearable
                                                           @on-change="search"
                                                           @on-focus="openTree"
                                                    />
                                                    <div class="tree-mask" :class="aa === 1 ? 'open':'close'"
                                                         @click="closeTree"></div>
                                                    <div class="tree-bar"
                                                         style="max-height: 99px;overflow: auto;width: 100%;z-index: 101"
                                                         v-show="this.aa===1">
                                                        <Tree ref="tree" :data="treeData"
                                                              @on-select-change="selectTree"></Tree>
                                                    </div>
                                                </div>
                                            </FormItem>
                                            <FormItem v-if="isViewPerson" prop="carInvoice.saleName" label="出卖方姓名"
                                                      :rules="{required: true, message: '出卖方姓名不能为空', trigger: 'blur'}">
                                                <Input type="text" v-model="formEntry.carInvoice.saleName"
                                                       :disabled="isDisabled"/>
                                            </FormItem>
                                            <FormItem v-if="isViewPerson" prop="carInvoice.saleCertNo" label="出卖方身份证号"
                                                      :rules="{required: true, message: '出卖方身份证号不能为空', trigger: 'blur'}">
                                                <Input type="text" v-model="formEntry.carInvoice.saleCertNo"
                                                       :disabled="isDisabled"/>
                                            </FormItem>
                                            <FormItem v-if="isViewPerson" prop="carInvoice.saleCertEndDate"
                                                      label="身份证有效期"
                                                      :rules="{required: true,type:'date', message: '身份证有效期不能为空', trigger: 'blur'}">
                                                <DatePicker type="date" v-model="formEntry.carInvoice.saleCertEndDate"
                                                            format="yyyy-MM-dd" :options="options3"
                                                            :disabled="isDisabled"></DatePicker>
                                            </FormItem>
                                            <FormItem v-if="isViewPerson" prop="carInvoice.salePhone" label="出卖方手机号"
                                                      :rules="{required: true, message: '出卖方手机号不能为空', trigger: 'blur'}">
                                                <Input type="text" v-model="formEntry.carInvoice.salePhone"
                                                       :disabled="isDisabled" maxlength="11"/>
                                            </FormItem>
                                            <FormItem label="最低开票价格" prop="carInvoice.invoiceAmt"
                                                      v-if="this.businessType==='01'">
                                                <Input type="text" v-model="formEntry.carInvoice.invoiceAmt" disabled/>
                                            </FormItem>
                                            <FormItem label="车辆型号" prop="carDetails.fullModelNum" :required=true>
                                                <Input type="text" v-model="formEntry.carDetails.fullModelNum"
                                                       :disabled="isCarDisabled" @keyup.native="carValite" maxlength="40"/>
                                            </FormItem>
                                            <FormItem label="VIN号" prop="carDetails.carVin" :required=true>
                                                <Input type="text" v-model="formEntry.carDetails.carVin" maxlength="17"
                                                       :disabled="VinIsDisabled" @keyup.native="vinoValite"/>
                                            </FormItem>
                                            <FormItem label="发动机号" prop="carDetails.engineNo" :required=true>
                                                <Input type="text" v-model="formEntry.carDetails.engineNo"
                                                       :disabled="isEnoDisabled" @keyup.native="enoValite" maxlength="20"/>
                                            </FormItem>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="3" v-if="isViewGps">
                                    <span>GPS信息</span>
                                    <span class="panel-head-right" @click.stop>
                                    <Button type="primary" @click="distribute" :loading="distributeLoading" style="margin-right: 5px"
                                            :disabled="isDistributeDisabled">派单
                                        </Button>
                                </span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="GPS供应商" prop="gpsInfo.gpsSupplier" :required=true>
                                                <Select v-model="formEntry.gpsInfo.gpsSupplier" filterable clearable
                                                        :disabled="isDistributeDisabled"
                                                        @on-change="changeGpsSupplier(formEntry.gpsInfo.gpsSupplier)">
                                                    <Option v-for="item in gpsSupplier" :value="item.value"
                                                            :key="item.value" :label="item.title">
                                                        {{ item.title }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <!--                                        <FormItem label="是否盗抢险" prop="gpsInfo.isRobberyBag" :required=true>-->
                                            <!--                                            <Select v-model="formEntry.gpsInfo.isRobberyBag" clearable-->
                                            <!--                                                    @on-change="changeIsRobberyBag" :disabled="isDistributeDisabled">-->
                                            <!--                                                <Option v-for="item in dataDic.isDefault" :value="item.value"-->
                                            <!--                                                        :key="item.value" :label="item.title">-->
                                            <!--                                                    {{ item.title }}-->
                                            <!--                                                </Option>-->
                                            <!--                                            </Select>-->
                                            <!--                                        </FormItem>-->
                                            <FormItem label="GPS类型" prop="gpsInfo.gpsType" style="display: none"
                                                      :rules="{required: true, message: 'GPS型号不能为空', trigger: 'blur'}">
                                                <!--                                            <Input type="text" v-model="formEntry.gpsInfo.gpsProductNo" disabled/>-->
                                                <Select v-model="formEntry.gpsInfo.gpsType" clearable
                                                        :disabled="isHaveGpsType">
                                                    <Option v-for="item in dataDic.gpsType" :value="item.value"
                                                            :key="item.value" :label="item.title">
                                                        {{ item.title }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem label="GPS型号">
                                                <Input type="text" v-model="gpsFullName" disabled/>
                                            </FormItem>
                                            <FormItem label="贷款期限" prop="gpsInfo.loanTerm">
                                                <Input type="text" v-model="formEntry.costDetails.loanTerm" disabled/>
                                            </FormItem>
                                            <FormItem label="现场联系人" prop="gpsInfo.siteContact" :required=true>
                                                <Input type="text" v-model="formEntry.gpsInfo.siteContact"
                                                       :disabled="isDistributeDisabled"/>
                                            </FormItem>
                                            <FormItem label="联系电话" prop="gpsInfo.contactPhone" :required=true>
                                                <Input type="text" v-model="formEntry.gpsInfo.contactPhone"
                                                       maxlength="11"
                                                       :disabled="isDistributeDisabled"/>
                                            </FormItem>
                                            <FormItem label="安装时间" prop="gpsInfo.preInstallTime" :required=true>
                                                <DatePicker type="date" v-model="formEntry.gpsInfo.preInstallTime"
                                                            format="yyyy-MM-dd"
                                                            :disabled="isDistributeDisabled"></DatePicker>
                                            </FormItem>
                                            <FormItem label="安装地址" prop="gpsInfo.installAddressTemp" :required=true>
                                                <Row type="flex" justify="start" align="middle">
                                                    <Cascader :data="initLoadData" :load-data="loadData"
                                                              v-model="formEntry.gpsInfo.installAddressTemp" filterable
                                                              :disabled="isDistributeDisabled"/>
                                                    <Col span="12">
                                                        <Input style="width: 371px;margin-left: 2px" type="text"
                                                               v-model="formEntry.gpsInfo.installAddress"
                                                               :disabled="isDistributeDisabled"/>
                                                    </Col>
                                                </Row>
                                            </FormItem>
                                            <FormItem v-if="isViewRobberyBag" prop="gpsInfo.houseAddressTemp"
                                                      label="户籍地址"
                                                      :required=isHouseAddressRequired>
                                                <Row type="flex" justify="start" align="middle">
                                                    <Cascader :data="initLoadData" :load-data="loadData"
                                                              v-model="formEntry.gpsInfo.houseAddressTemp" filterable
                                                              :disabled="isDistributeDisabled"/>
                                                    <Col span="12">
                                                        <Input style="width: 300px" type="text"
                                                               v-model="formEntry.gpsInfo.houseAddress"
                                                               :disabled="isDistributeDisabled"/>
                                                    </Col>
                                                </Row>
                                            </FormItem>
                                            <FormItem label="备注" prop="gpsInfo.remarks">
                                                <Input  type="textarea" size="small"
                                                       v-model="formEntry.gpsInfo.remarks"
                                                       :disabled="isDistributeDisabled"/>
                                            </FormItem>

                                            <!--                                        <Button type="primary" @click="distribute" :loading="distributeLoading" :disabled="isDistributeDisabled">派单</Button>-->
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="4">
                                    <span>银行卡信息</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="签约方式" prop="bankCard.authorizeWay" :required=true>
                                                <Select v-model="formEntry.bankCard.authorizeWay" clearable
                                                        @on-change="changeVerType" :disabled="isBankDisabled">
                                                    <Option value="offline">线下签署</Option>
                                                    <Option value="online">电子签署</Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem label="开户人" prop="bankCard.certNo" :required=true>
                                                <Select v-model="formEntry.bankCard.certNo" clearable
                                                        :disabled="isBankDisabled">
                                                    <Option v-for="item in accountPerson" :value="item.certNo"
                                                            :key="item.certNo" :label="item.custName">
                                                        {{ item.custName }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem label="还款银行" prop="bankCard.bankCode" :required=true>
                                                <Select v-model="formEntry.bankCard.bankCode" clearable
                                                        :disabled="isBankDisabled">
                                                    <Option v-for="item in dataDic.bank" :value="item.value"
                                                            :key="item.value"
                                                            :label="item.title">
                                                        {{ item.title }}
                                                    </Option>
                                                </Select>
                                            </FormItem>
                                            <FormItem label="还款帐号" prop="bankCard.accountNo" :required=true>
                                                <Input type="text" v-model="formEntry.bankCard.accountNo" maxlength="20"
                                                       :disabled="isBankDisabled"/>
                                            </FormItem>
                                            <FormItem label="开卡省市" prop="bankCard.openAddressTemp" :required=true>
                                                <Cascader :data="initLoadData" :load-data="loadData"
                                                          v-model="formEntry.bankCard.openAddressTemp" filterable
                                                          :disabled="isBankDisabled"/>
                                            </FormItem>
                                            <div v-show="isViewVer">
                                                <FormItem label="预留手机号码" prop="bankCard.bankPhone" :required=isViewVer>
                                                    <Input type="text" v-model="formEntry.bankCard.bankPhone"
                                                           :disabled="isBankDisabled" maxlength="11"/>
                                                    <Button type="info" @click="getPhoneCode"
                                                            :disabled="isBankDisabled">
                                                        获取验证码
                                                    </Button>
                                                </FormItem>
                                                <FormItem label="验证码" prop="bankCard.verCode" :required=isViewVer>
                                                    <Input type="text" v-model="formEntry.bankCard.verCode"
                                                           :disabled="isBankDisabled"/>
                                                    <Button type="info" @click="conform" :disabled="isBankDisabled">确定
                                                    </Button>
                                                </FormItem>
                                            </div>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="5">
                                    <span>保险信息</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <Row>
                                                <FormItem label="投保方式" :required=insuranceModeIsRequired>
                                                    <Select v-model="insuranceInfoBusiness.insuranceMode" clearable
                                                            @on-change="changeInsuranceMode" :disabled="isDisabled">
                                                        <Option value="paper">纸质保单</Option>
                                                        <Option value="electronics">电子保单</Option>
                                                    </Select>
                                                </FormItem>
                                            </Row>
                                            <Row>
                                                <FormItem label="商业险-保险公司" :required=isInsuranceRequired
                                                          v-if="this.modelType == 2">
                                                    <Select v-model="insuranceInfoBusiness.insuranceCompany" clearable
                                                            :disabled="isDisabled">
                                                        <Option v-for="item in dataDic.insurance" :value="item.value"
                                                                :key="item.value" :label="item.title">
                                                            {{ item.title }}
                                                        </Option>
                                                    </Select>
                                                </FormItem>
                                                <FormItem label="商业险-保单号" :required=isInsuranceRequired
                                                          v-if="this.modelType == 2">
                                                    <Input type="text" v-model="insuranceInfoBusiness.insuranceNo"
                                                           :disabled="isDisabled"/>
                                                </FormItem>
                                            </Row>
                                            <Row>
                                                <FormItem label="商业险开始日期"  :required=true v-if="this.modelType == 1">
                                                    <DatePicker type="date"
                                                                v-model="insuranceInfoBusiness.insuranceStartTime"
                                                                @on-change="businessDate" format="yyyy-MM-dd"
                                                                :disabled="isDisabled" transfer></DatePicker>
                                                </FormItem>
                                                <FormItem label="商业险结束日期" :required=true v-if="this.modelType == 1">
                                                    <DatePicker type="date"
                                                                v-model="insuranceInfoBusiness.insuranceEndTime"
                                                                format="yyyy-MM-dd"
                                                                :disabled="isDisabled" transfer></DatePicker>
                                                </FormItem>
                                            </Row>
                                            <Row>
                                                <FormItem label="交强险-保险公司" :required=isInsuranceRequired
                                                          v-if="this.modelType == 2">
                                                    <Select v-model="insuranceInfo.insuranceCompany" clearable
                                                            :disabled="isDisabled">
                                                        <Option v-for="item in dataDic.insurance" :value="item.value"
                                                                :key="item.value" :label="item.title">
                                                            {{ item.title }}
                                                        </Option>
                                                    </Select>
                                                </FormItem>
                                                <FormItem label="交强险-保单号" :required=isInsuranceRequired
                                                          v-if="this.modelType == 2">
                                                    <Input type="text" v-model="insuranceInfo.insuranceNo"
                                                           :disabled="isDisabled"/>
                                                </FormItem>
                                            </Row>
                                            <Row>
                                                <FormItem label="交强险开始日期" :required=isInsuranceRequired
                                                          v-if="this.modelType == 3">
                                                    <DatePicker type="date" v-model="insuranceInfo.insuranceStartTime"
                                                                format="yyyy-MM-dd" :disabled="isDisabled"></DatePicker>
                                                </FormItem>
                                                <FormItem label="交强险结束日期" :required=isInsuranceRequired
                                                          v-if="this.modelType == 3">
                                                    <DatePicker type="date" v-model="insuranceInfo.insuranceEndTime"
                                                                format="yyyy-MM-dd" :disabled="isDisabled"></DatePicker>
                                                </FormItem>
                                            </Row>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="6" v-if="this.formEntry.orderInfo.affiliatedWay == '02'">
                                    <span>个体工商户挂靠</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="个体工商户名称" prop="affiliatedUnit.affiliatedName"
                                                      :rules="{required: true, message: '个体工商户名称不能为空', trigger: 'change'}">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.affiliatedName"
                                                       :disabled="isDisabled"/>
                                            </FormItem>
                                            <FormItem label="统一社会信用代号" prop="affiliatedUnit.socUniCrtCode" :required=true>
<!--                                                      :rules="{required: true, message: '统一社会信用代号不能为空', trigger: 'change'}">-->
                                                <Input type="text" v-model="formEntry.affiliatedUnit.socUniCrtCode"
                                                       :disabled="isDisabled" maxlength="18" @keyup.native="socValite"/>
                                            </FormItem>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="7" v-else-if="this.formEntry.orderInfo.affiliatedWay == '03'">
                                    <span>网约车挂靠</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="运营公司" prop="affiliatedUnit.affiliatedName">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.affiliatedName"
                                                       disabled/>
                                            </FormItem>
                                            <FormItem label="网约车平台" prop="cooperPlatform">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.cooperPlatform"
                                                       disabled/>
                                            </FormItem>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="8" v-else-if="this.formEntry.orderInfo.affiliatedWay == '01'">
                                    <span>第三方公司挂靠</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem label="公司名称" prop="affiliatedUnit.affiliatedName">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.affiliatedName"
                                                       disabled/>
                                            </FormItem>
                                            <FormItem label="统一社会信用代号" prop="affiliatedUnit.socUniCrtCode">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.socUniCrtCode"
                                                       disabled/>
                                            </FormItem>
                                            <FormItem label="法人姓名" prop="affiliatedUnit.legalName">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.legalName"
                                                       disabled/>
                                            </FormItem>
                                            <FormItem label="联系电话" prop="affiliatedUnit.legalPhone">
                                                <Input type="text" v-model="formEntry.affiliatedUnit.legalPhone"
                                                       disabled/>
                                            </FormItem>
                                            <FormItem label="注册地址" prop="affiliatedUnit.affiliatedRegistAddress">
                                                <Row type="flex" justify="start" align="middle">
                                                    <Cascader :data="initLoadData" :load-data="loadData"
                                                              v-model="formEntry.affiliatedUnit.registAddressTemp"
                                                              filterable disabled/>
                                                    <Col span="12">
                                                        <Input style="width: 371px;margin-left: 2px" type="text"
                                                               v-model="formEntry.affiliatedUnit.registAddress"
                                                               disabled/>
                                                    </Col>
                                                </Row>
                                            </FormItem>
                                            <FormItem label="运输许可证有效期" prop="affiliatedUnit.licenceEndDate">
                                                <DatePicker type="date"
                                                            v-model="formEntry.affiliatedUnit.licenceEndDate"
                                                            format="yyyy-MM-dd" disabled></DatePicker>
                                            </FormItem>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="9" v-if="this.formEntry.financingItems.length>0">
                                    <span>附加贷信息</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <FormItem :label="item.financeItemName" :key="item.id"
                                                      v-for="(item,index) in formEntry.financingItems"
                                                      v-if="!Object.prototype.hasOwnProperty.call(item,'upperId') && item.isView"
                                                      :required=true>
                                                <Input v-if="item.isParent" type="number"
                                                       v-model="formEntry.financingItems[index].financeItemAmt"
                                                       @on-focus="setDecoration(item.id)" :disabled="isDisabled"/>
                                                <Input v-else type="number"
                                                       v-model="formEntry.financingItems[index].financeItemAmt"
                                                       :disabled="isDisabled"
                                                />
                                            </FormItem>
                                            <FormItem :label="item.financeItemName+'明细'" v-for="(item,index) in formEntry.financingItems"
                                                      v-if="item.isParent">
                                                <Input style="width: 450px" type="text" v-model="decorationDetailed"
                                                       disabled/>
                                            </FormItem>
                                        </div>
                                    </div>
                                </Panel>
                                <Panel name="10">
                                    <span>证件更新</span>
                                    <div class="panel-content" slot="content">
                                        <div class="form-box">
                                            <Table border :row-class-name="rowClassName" :columns="custColumnsHead"
                                                   :data="formEntry.custBaseInfos">
                                                <template slot-scope="{ row, index }" slot="custRole">
                                                    <div v-if="row.custRole === '01'">主借人</div>
                                                    <div v-else-if="row.custRole === '02'">共借人</div>
                                                    <div v-else-if="row.custRole === '03'">担保人</div>
                                                </template>
                                                <template slot-scope="{ row, index }" slot="isLongTerm">
                                                    <div v-if="row.isLongTerm">是</div>
                                                    <div v-else-if="!row.isLongTerm">否</div>
                                                </template>
                                                <template slot-scope="{ row, index }" slot="certType">
                                                    <div v-if="row.certType === '00001'">身份证</div>
                                                    <div v-else-if="row.certType === '00002'">户口本</div>
                                                    <div v-else-if="row.certType === '00003'">护照</div>
                                                    <div v-else-if="row.certType === '00004'">军官证</div>
                                                    <div v-else-if="row.certType === '00005'">港澳居民来往内地通行证</div>
                                                    <div v-else-if="row.certType === '00006'">台湾同胞来往内地通行证</div>
                                                </template>
                                                <template slot-scope="{ row, index }" slot="operation">
                                                    <Button type="primary" icon="ios-create" style="margin-right: 5px"
                                                            @click="editCustInfo(row)" :disabled="isCustDisabled">变更
                                                    </Button>
                                                </template>
                                            </Table>
                                        </div>
                                    </div>
                                </Panel>
                            </Collapse>
                        </Form>
                    </div>
                </TabPane>
                <TabPane label="影像上传" name="uploadInfo">
                    <div class="tab">
                        <div style="height: 10%">
                            <Form :model="formEntry" :rules="witnessValidate" :label-width="120" inline>
                                <FormItem label="见证人" prop="contractInfo.witnessIdCard">
                                    <Select v-model="formEntry.contractInfo.witnessIdCard" :disabled="isDisabled" filterable size="small">
                                        <Option v-for="item in witnessList" :value="item.witnessIdCard" :key="item.witnessIdCard">{{ item.witnessName }}</Option>
                                    </Select>
                                </FormItem>
                                <FormItem label="证件号码">
                                    <Input type="text" v-model="formEntry.contractInfo.witnessIdCard" disabled/>
                                </FormItem>
                            </Form>
                        </div>
                        <div style="width: 100%;height: 88%">
                            <file-operation
                                :uploadParam="uploadParam" :isInt="isInt" :path="path" :read-only="fileRead">

                            </file-operation>
                        </div>
                    </div>
                </TabPane>
            </Tabs>
            <div class="tabsBox" style="padding-top: 16px;">
            </div>

            <FixedNav :showSave="showType!=1" @save="save" :showDownloadFile="isDownLoad && !fileDownLoad"
                      @downloadFile="downloadFile" :saveFlag="saveFlag"/>
            <div class="footer">
                <div class="footer_content">
                    <div v-show="openTabs === 'baseInfo'">
                        <Button type="primary" v-if="showType!=1" @click="save('forever')" size="default">下一步 影像上传</Button>
                        <Button :loading="saveLoading" type="primary" size="default" v-if="showType!=1"
                                @click="checkFileMethed">提交
                        </Button>
                    </div>
                    <div v-show="openTabs === 'uploadInfo'">
                        <Button :loading="saveLoading" type="primary" size="default" v-if="showType!=1"
                                @click="checkFileMethed">提交
                        </Button>
                    </div>
                </div>
            </div>
            <!--                <div class="div-entry">-->
            <!--                    <div class="div-button-class">-->
            <!--                        <Button type="primary" @click="contractBatchPrint">模板生成</Button>-->
            <!--                        <Button type="primary" @click="downloadFile" v-if="isDownLoad" :disabled="fileDownLoad">文件下载-->
            <!--                        </Button>-->
            <!--                        <Button type="primary" @click="loanInfoUploadBtn">放款资料上传</Button>-->
            <!--                        <Button $store.getters.permissions['contract_input_submit']"  type="primary" @click="checkFileMethed"-->
            <!--                                v-if="showType!=1" :loading="submitLoading">-->
            <!--                            提交-->
            <!--                        </Button>-->
            <!--                        <Button type="primary" @click="returnBack">返回</Button>-->
            <!--                    </div>-->
            <!--                    <div class="div-container" style="overflow:auto;height: 90%;">-->
            <!--                        <div slot="footer" class="class-footer" v-if="isContractEntry">-->
            <!--                            <Button :loading="saveLoading" style="margin-right: 30px" type="primary" size="default"-->
            <!--                                    v-if="showType!=1" @click="save('temp')">暂存-->
            <!--                            </Button>-->
            <!--                            <Button :loading="saveLoading" type="primary" size="default" v-if="showType!=1"-->
            <!--                                    @click="save('forever')">保存-->
            <!--                            </Button>-->
            <!--                        </div>-->
            <!--                        <Spin size="large" fix v-if="spinShow"></Spin>-->
            <!--                    </div>-->
            <!--                </div>-->
        </div>
        <Modal title="更改客户信息" v-model="menuModalVisibleCust" :mask-closable='false' :width="700">
            <Form ref="formCust" :model="formCust" :rules="formCustRules" :label-width="160" inline>
                <FormItem label="有效期变更" prop="certEndDate" style="text-align:center;"
                          :rules="{required: true,type:'date', message: '有效期变更不能为空', trigger: 'blur'}">
                    <DatePicker type="date" v-model="formCust.certEndDate"
                                format="yyyy-MM-dd"></DatePicker>
                </FormItem>
                <FormItem label="是否长期" prop="isLongTerm">
                    <Checkbox v-model="formCust.longTermOrNot" @on-change="selectCheck">长期</Checkbox>
                </FormItem>
                <div class="uploadInfo pr" v-if="isupload">
                    <label>影像信息</label>
                    <card-upload ref="carUpload" :frontType="contractFrontType"
                                 :balckType="contractBlackType"
                                 @queryFmInfo="queryFmInfo"
                                 ></card-upload>
                </div>
            </Form>
            <div slot="footer" class="class-footer">
                <Button type="primary" v-if="showType!=1" @click="submitCust" :loading="saveLoading">保存</Button>
                <Button type="text" v-if="showType!=1" @click="closeCust">关闭</Button>
            </div>
        </Modal>
        <Modal title="装潢融资项" v-model="menuModalVisibleDecoration" :mask-closable='false' :width="500">
            <Form ref="formEntryChild" :model="formEntry" :label-width="160" inline>
                <FormItem :label="item.financeItemName"
                          v-if="Object.prototype.hasOwnProperty.call(item,'upperId') && item.upperId==upperId  && item.isView == true"
                          v-for="item in formEntry.financingItems">
                    <Input type="number" v-model="item.financeItemAmt" :disabled="isDisabled"/>
                </FormItem>
            </Form>
            <div slot="footer" class="class-footer">
                <Button type="primary" v-if="showType!=1" :loading="saveLoading" @click="saveDecoration">保存</Button>
                <Button type="text" v-if="showType!=1" @click="cencalDecoration">关闭</Button>
            </div>
        </Modal>
        <Modal title="文件模版" v-model="templateModel" :mask-closable='false' width="60%">
            <div class="roleCheckGroup">
                <div>
                    <Button class="allBtn">
                        <Checkbox
                            :indeterminate="indeterminate"
                            :value="checkAll"
                            class="checkAll"
                            @click.prevent.native="handleCheckAll">
                            全部
                        </Checkbox>
                    </Button>
                    <Button @click="downloadBatchFile(fileList)">批量下载</Button>
                </div>
                <div>
                    <CheckboxGroup v-model="checkAllGroup" @on-change="checkAllGroupChange">
                        <Row v-for="(item,index) in fileList" style="padding: 5px 0px">
                            <Col span="11" offset="1">
                                <Checkbox
                                    :label="item.attachmentCode"
                                    :key="item.attachmentCode"
                                    style="margin-top: 3px;" @click="getAttachmentData">
                                    <span>{{ item.fileName }}</span>
                                </Checkbox>
                            </Col>
                            <Col span="4">
                                <span>{{ item.createTime }}</span>
                            </Col>
                            <Col span="3">
                                <!-- <Button>打印预览</Button> -->
                                <Button @click="pdfPreview(item)">预览</Button>
                            </Col>
                            <Col span="4">
                                <Button @click="downloadSingleFile(item)">下载</Button>
                            </Col>
                        </Row>
                    </CheckboxGroup>
                </div>
            </div>
        </Modal>
    </div>
</template>

<script>
    import {
        distribute,
        getAccountPerson,
        getEntryPageInfo,
        getGpsSupplier,
        getLendingMode,
        loanApplySubmitInfo,
        saveToBackend,
        getdrawerParty,
        getWitnessInfo,
        doVerify,
        signBank,
        getGpsFullName,
        getIsFirstMortgage
    } from "_p/afs-apply/api/apply-contract/contract/entry/contract-entry";
    import {getLocation} from "_p/afs-apply/api/apply-report/personal/common";
    import {formOperation} from "@/libs/utils/form-operation-util";
    import {getByTypes} from "_p/basic/api/admin/datadic";
    import {getDictDataByType} from "_p/basic/api/admin/datadic.js";
    import {
        custColumnsHead,
        recordTableHead,
        specialTableHead
    } from "_p/afs-apply/api/apply-contract/contract/entry/contract-entry-table-head";
    import {deepClone} from '@/libs/utils/ObjectClone';
    import basicinfo from "_p/afs-apply/pages/apply-report/common/apply-basic-info.vue";
    import * as applyUtils from '_p/afs-apply/assets/js/utils.js'
    import utils from "@/libs/util.js";
    import {getChannelId} from "@/projects/afs-apply/api/register-mng/listRecord";
    import {getFilterParams} from "../../../../api/apply-report/personal/common";
    import FileOperation from "../../../../../basic/pages/image/upload-file/fileOperation";
    import {
        contractBatchPrint,
        downloadBatchFile,
        downloadSingleFile,
        getComAttach
    } from "../../../../api/contract/corporate/corporateTransferManagement";
    import CardUpload from "@/components/identitycard-upload"
    import {
        checkFile,
    } from "_p/basic/api/image/image-upload";
    import {
        getQuotaListByChannelId
    } from '_p/afs-apply/api/home/home.js'
    import {saveCopy} from "../../../../api/order-mng/loanApplyMngApi";
    import {getUserInfo} from "../../../../../basic/api/admin/user";
    import FixedNav from './fixedNav'
    export default {
        components: {
            FileOperation,
            FixedNav,
            'basicinfo': basicinfo,
            CardUpload
        },
        computed: {
            businessTypeStr: function () {
                for (let i = 0; i < this.dataDic.businessType.length; i++) {
                    if (this.dataDic.businessType[i].value === this.formEntry.orderInfo.businessType) {
                        return this.dataDic.businessType[i].title;
                    }
                }
            },
            operateWayStr: function () {
                for (let i = 0; i < this.dataDic.operateWay.length; i++) {
                    if (this.dataDic.operateWay[i].value === this.formEntry.orderInfo.operateWay) {
                        return this.dataDic.operateWay[i].title;
                    }
                }
            },
            affiliatedWayStr: function () {
                for (let i = 0; i < this.dataDic.affiliatedWay.length; i++) {
                    if (this.dataDic.affiliatedWay[i].value === this.formEntry.orderInfo.affiliatedWay) {
                        return this.dataDic.affiliatedWay[i].title;
                    }
                }
            },
            carPurposeStr: function () {
                for (let i = 0; i < this.dataDic.carPurpose.length; i++) {
                    if (this.dataDic.carPurpose[i].value === this.formEntry.orderInfo.carPurpose) {
                        return this.dataDic.carPurpose[i].title;
                    }
                }
            },
        },
        data() {
            let isVinNoValiate = (rule, value, callback) => {
                if (value) {
                    if (!applyUtils.isCharNum(value)) {
                        callback(new Error("格式为英文与数字"))
                        return;
                    } else {
                        if (value.length != 17) {
                            callback(new Error("vin号位数为17位"))
                            return;
                        }
                    }
                }
                callback()
            }
            let isSocValiate = (rule, value, callback) => {
                if (value) {
                    if (!applyUtils.isMoreCharNum(value)) {
                        callback(new Error("格式为英文与数字或纯数字"))
                        return;
                    } else {
                        if (value.length != 18) {
                            callback(new Error("社会统一信用代码位数为18位"))
                            return;
                        }
                    }
                }
                callback()
            }
            let isAccValiate = (rule, value, callback) => {
                if (value) {
                    console.log(!applyUtils.isPositiveInteger(value), "!utils.isPositiveInteger(value)")
                    if (!applyUtils.isPositiveInteger(value)) {
                        callback(new Error("格式为数字"))
                        return;
                    }
                }
                callback()
            }
            let affiliatedNameValiate = (rule, value, callback) => {
                if (value) {
                    if (value.indexOf('有限公司') != "-1" || value.indexOf('有限责任公司') != "-1" || value.indexOf('股份有限公司') != "-1") {
                        callback(new Error("不允许出现有限公司、有限责任公司和股份有限公司文字"))
                        return;
                    }
                }
                callback();
            }
            return {
                openPanel: [1,2,3,4,5,6,7,8,9,10],
                openTabs:'baseInfo',
                tabsType: [
                    {
                        value: "baseInfo",
                        title: '基本信息'
                    },
                    {
                        value: "uploadInfo",
                        title: '影像上传'
                    },
                ],
                treeLoading: false,
                contractFrontType:"",
                contractBlackType:"",
                contractStatus:'',
                isBankDisabled:false,
                isCustDisabled:false,
                fileDownLoad:true,
                path: "apply",
                imgzurl: '',
                imgfurl: '',
                isupload: false,
                imgurlList: [{"imgurl": "2ceac3114f0534c9b1e889af827e8b19", "randomStr": "1"}],
                backInfo:0,
                isInt: false,
                indeterminate: false,
                fileRead:false,
                checkAll: false,
                gpsFullName:'',
                businessType: '',
                checkAllGroup: [],
                witnessList:[],
                treeData: [], // 树数据
                newSurplus:0,//新车剩余
                oldSurplus:0,//二手车剩余
                newOccupied:0,//新车占用
                oldOccupied:0,//二手车占用
                aa: 0,
                fileList: [
                    {
                        id: "",
                        createBy: "",
                        createTime: "",
                        delFlag: "",
                        busiNo: "",
                        attachmentCode: "",
                        attachmentName: "",
                        fileStatus: "",
                        fileType: "",
                        fileName: "",
                        fileId: "",
                        uploadTime: ""
                    },
                    {
                        id: "",
                        createBy: "",
                        createTime: "",
                        delFlag: "",
                        busiNo: "",
                        attachmentCode: "",
                        attachmentName: "",
                        fileStatus: "",
                        fileType: "",
                        fileName: "",
                        fileId: "",
                        uploadTime: ""
                    }
                ],
                uploadParam: {
                    busiNo: "",
                    belongNo: "",
                    busiType: "loanApply",
                    busiData: {}
                },
                applyNo: "",
                isContractEntry: true,
                isViewGps: true,
                sign: "signing",
                uploadFileModal: false,
                insuranceModeIsRequired: true,
                templateModel: false,
                isVinNoValiate: isVinNoValiate,
                isSocValiate: isSocValiate,
                isAccValiate: isAccValiate,
                isDisabled: false,
                isHaveGpsType: false,
                showInvoiceNature: true,
                //影响上传Flag
                imageFlag: false,
                isEnoDisabled: false,
                isCarDisabled: false,
                houseAddressTemp: [],
                showType: 0,
                isDistribute: false,
                installAddressTemp: [],
                houseAddress: "",
                modelType: 0,
                gpsSupplier: [],
                saveFlag:"0",
                isDownLoad: true,
                isHouseAddressRequired: false,
                saleNameRequired: false,
                saleCertEndDateRequired: false,
                saleCertNoRequired: false,
                salePhoneRequired: false,
                isInsuranceRequired: false,
                isViewVer: false,
                userRelName:'',
                phone:'',
                isViewRobberyBag: false,
                isViewPerson: false,
                menuModalVisibleCust: false,
                menuModalVisibleDecoration: false,
                saveLoading: false,
                distributeLoading: false,
                submitLoading: false,
                isDistributeDisabled: false,
                VinIsDisabled: false,
                initLoadData: [],
                quotaControlSwitch:null,
                options3: {
                    disabledDate(date) {
                        return date && date.valueOf() < Date.now() - 86400000;
                    }
                },
                gpsLoanTerm: 0,
                firstMortgage:false,
                recordColumnsHead: recordTableHead,
                specialTableHead: specialTableHead,
                custColumnsHead: custColumnsHead,

                isDisAmt: false,
                upperId: "",
                financingItemsAmt: "",
                decorationDetailed: "",
                isSave: 0,
                contractNo: '',
                formCust: {},
                formCustRules: {},
                formRules: {
                    'affiliatedUnit.socUniCrtCode' :[]
                    // affiliatedName: [
                    //         {required: true, message: "个体工商挂靠名称不能为空", trigger: "change"},
                    //         {validator: affiliatedNameValiate, trigger: "blur"}
                    //     ],
                },
                witnessValidate:{
                    'contractInfo.witnessIdCard':[
                        {required: true, message: "见证人不能为空", trigger: "change"}
                    ]
                },
                insuranceInfo: {},
                insuranceInfoBusiness: {},
                formEntry: {
                    flag: "",
                    orderInfo: {},
                    carInvoice: {},
                    gpsInfo: {},
                    bankCard: {},
                    affiliatedUnit: {},
                    financingItems: [],
                    returnRecords: [],
                    insuranceInfos: [],
                    applyOprRecords: {},
                    custAddressDetails: {},
                    carDetails: {},
                    contractInfo: {},
                    custBaseInfos: [],
                    recordDetails: [],
                    custHistory: [],
                    costDetails: {},
                },
                channelId:'',
                //定义数据字典接收
                dataDic: {
                    businessType: [],
                    operateWay: [],
                    affiliatedWay: [],
                    carPurpose: [],
                },
                accountPerson: [],
                lendingMode: [],
                loanTerm: 0,
                // 加载状态
                spinShow: false,
                canUpload: true,
            }
        },
        created() {
            if (this.afs.getPageParams(this)) {
                this.applyNo = this.afs.getPageParams(this).applyNo;
                this.contractNo=this.afs.getPageParams(this).contractNo;
                this.contractStatus=this.afs.getPageParams(this).contractStatus;
                // if (this.applyNo !== null || this.applyNo !== '') {
                //     this.initGetFilterParams();
                // }
                if (this.afs.getPageParams(this).contractType) {
                    this.isDownLoad = true;
                } else {
                    this.isDownLoad = false;
                }
                if (this.afs.getPageParams(this).type === 1) {
                    this.saveFlag="1";
                    this.showType = 1;
                    this.fileRead=true;
                    this.isContractEntry = false;
                    this.isCarDisabled = true;
                    this.isCustDisabled=true;
                    this.VinIsDisabled = true;
                    this.isEnoDisabled = true;
                    this.isBankDisabled = true;
                }
                if(this.contractStatus==='05'){
                    this.isContractEntry = true;
                    this.isCustDisabled=false;
                    this.VinIsDisabled = true;
                    this.isEnoDisabled = true;
                    this.isCarDisabled = true;
                    this.isBankDisabled = true;

                }
            }
        },
        mounted() {
            this.init();
        },
        updated() {
            if (this.canUpload) {
                let formEntry = this.$refs.formEntry
                if (formEntry && formEntry.fields && formEntry.fields.length) {
                    this.loadForm();
                    this.canUpload = false;
                }
            }
        },
        methods: {
            queryFmInfo(data){
                if(data){
                    let time=data.validUntil.replace('-','/');
                    this.formCust = Object.assign({},this.formCust,{certEndDate:new Date(time)})
                    console.log(this.formCust,"this.formCust.certEndDate")
                }
            },
            vinoValite(){
                this.formEntry.carDetails.carVin=this.formEntry.carDetails.carVin.toUpperCase();
                this.formEntry.carDetails.carVin=this.formEntry.carDetails.carVin.replace(/[IQO]/g,'');
            },
            carValite(){
                this.formEntry.carDetails.fullModelNum=this.formEntry.carDetails.fullModelNum.toUpperCase();
                this.formEntry.carDetails.fullModelNum=this.formEntry.carDetails.fullModelNum.replace(/[IO]/g,'');
            },
            enoValite(){
                this.formEntry.carDetails.engineNo=this.formEntry.carDetails.engineNo.toUpperCase();
                this.formEntry.carDetails.engineNo=this.formEntry.carDetails.engineNo.replace(/[IO]/g,'');
            },
            socValite(){
                this.formEntry.affiliatedUnit.socUniCrtCode=this.formEntry.affiliatedUnit.socUniCrtCode.toUpperCase();
            },
            //获取点选数据
            getAttachmentData(v) {
                console.log("点选获取的值:", v);
            },
            //模板生成
            contractBatchPrint() {
                let params = {
                    applyNo: this.applyNo,
                    contractNo:this.contractNo
                }
                contractBatchPrint(params).then(res => {
                    if (res.code === '0000') {
                        // this.$Message.success("模板已生成")
                        this.initGetComAttach();
                        this.templateModel = true;
                        // this.fileDownLoad=false;
                    }
                })
            },
            //批量文件下载
            downloadBatchFile(v) {
                let downFileList=[];
                if(this.checkAllGroup.length>0){
                    if(v.length>0){
                        let tempArr=[];
                        v.forEach((item,index)=>{
                            if(this.checkAllGroup.indexOf(item.attachmentCode)!="-1"){
                                tempArr.push(item);
                            }
                        })
                        downFileList=tempArr;
                    }
                }else{
                    this.$Message.warning("请选择文件模版下载");
                    return false;
                }
                let params = {
                    attachmentList:downFileList,
                    applyNo: this.contract
                }
                let self = this;
                downloadBatchFile(params).then(function (response) {
                    if (response.status === 200) {
                        self.afs.downloadFile(response);
                    }
                })
            },
            pdfPreview(item){
                let pdfurl = `${_AFS_PROJECT_CONFIG.apiUri}/${this.path}/upload/getBlob/pdf/${item.fileId}`;
                window.open(pdfurl);
            },
            //单个文件下载
            downloadSingleFile(item) {
                let params = {
                    id: item.id
                }
                let self = this;
                downloadSingleFile(params).then(function (response) {
                    if (response.status === 200) {
                        self.afs.downloadFile(response);
                    }
                })
            },
            initGetComAttach() {
                let params = {
                    busiNo: this.contractNo,
                    pageSize:500,
                    pageNumber:1,
                    printNode:"printLoanApply"

                }
                getComAttach(params).then(res => {
                    if (res.code === '0000') {
                        this.fileList = res.data.records;
                        console.log(res.data);
                    }
                })
            },
            //放款资料上传按钮
            loanInfoUploadBtn() {
                // this.save();
                if (this.contractNo == '' || this.contractNo == undefined) {
                    this.$Message.info("您好，请先录合同信息");
                } else {
                    getWitnessInfo({businessAttributes:this.formEntry.orderInfo.businessType}).then(res =>{
                       if(res.code==='0000'){
                           console.log(res.data);
                           this.witnessList=res.data;
                       }
                    });
                    this.initGetFilterParams();
                    this.uploadFileModal = true;
                }
            },
            // 查询影像件需要的数据
            initGetFilterParams() {
                let params = {
                    applyNo: this.applyNo,
                }
                getFilterParams(params).then(res => {
                    if (res.code === '0000') {
                        this.uploadParam.busiNo = this.contractNo;
                        this.uploadParam.belongNo = this.contractNo;
                        this.uploadParam.busiData = res.data;
                        this.uploadParam.busiType = "loanApply";
                        this.isInt = true;
                    }
                });
            },
            init() {
                this.initSelectData();
                this.getIsFirstModel();
                this.getEntryPageInfo();
                // this.loadForm();
                this.setDisabled();
                this.initGteUserInfo();
            },
            getIsFirstModel(){
                getIsFirstMortgage({applyNo:this.applyNo}).then(res =>{
                    if(res.code==="0000"){
                        this.firstMortgage=res.data;
                    }
                })
            },

            //初始化获得用户信息
            initGteUserInfo() {
                getUserInfo().then(res => {
                    if (res.code === '0000') {
                        let sysUser = res.data.sysUser;
                        this.userRelName = sysUser.userRealName;
                        this.phone=sysUser.phone;
                    }
                })
            },
            //加载页面form校验
            loadForm() {
                console.log(this.$refs.formEntry,'this.$refs.formEntry.fields')
                formOperation(this.$refs.formEntry.fields, this.formRules);
                this.extraValiate(this.formRules);
                console.log(this.formRules, "formRules");
            },
            extraValiate(formRules) {
                console.log('formRulesformRulesformRulesformRules',formRules)
                formRules['carDetails.carVin'].push({
                    validator: this.isVinNoValiate,
                    trigger: "blur"
                })
                formRules['carDetails.engineNo'].push({
                    validator: applyUtils.isMoreCharNumValitate,
                    trigger: "blur"
                })
                formRules['carDetails.fullModelNum'].push({
                    validator: applyUtils.isCharNumValitate,
                    trigger: "blur"
                })
                formRules['gpsInfo.contactPhone'].push({
                    validator: applyUtils.isPhoneValiate,
                    trigger: "blur",
                })
                formRules['bankCard.accountNo'].push({
                    validator: this.isAccValiate,
                    trigger: "blur"
                })
                formRules['affiliatedUnit.socUniCrtCode'].push({
                    validator: this.isSocValiate,
                    trigger: "blur"
                })
                formRules['bankCard.accountNo'].push({
                    validator: applyUtils.isPositiveInt,
                    trigger: "blur"
                })
            },
            //设置页面禁用元素
            setDisabled() {
                if (this.isContractEntry) {
                    this.isDisabled = false;
                    this.isDisAmt = false;
                    // this.isBankDisabled=false;
                } else {
                    this.isDisabled = true;
                    this.isDistributeDisabled = true;
                    this.VinIsDisabled = true;
                    this.isDisAmt = true;
                    this.isEnoDisabled = true;
                    // this.isBankDisabled=true;
                }
            },
            //加载页面数据
            getEntryPageInfo() {
                getEntryPageInfo(this.applyNo).then(res => {
                    if (res.code === "0000") {
                        this.formEntry = deepClone(res.data);
                        this.businessType = this.formEntry.orderInfo.businessType;
                        if(typeof res.data.gpsFullName!=="undefined"){
                            this.gpsFullName=res.data.gpsFullName;
                        }
                        if(this.contractStatus==='05'){
                            if(this.formEntry.returnRecords.length>0){
                                this.formEntry.returnRecords.forEach(en => {
                                    if (Object.is(en.uniqueCode, "loanContractFile")&& en.isStandard==="notStandard") {
                                        if (this.formEntry.orderInfo.businessType === "01" && this.formEntry.orderInfo.carNature != "02") {
                                            this.VinIsDisabled = false;
                                            this.isEnoDisabled = false;
                                            this.isCarDisabled = false;
                                        }
                                    }
                                    if ((Object.is(en.uniqueCode, "remitAuthorizationFile")&& en.isStandard==="notStandard") || (Object.is(en.uniqueCode, "payerBankCard")&& en.isStandard==="notStandard")) {
                                        this.isBankDisabled = false;
                                    }
                                });
                            }
                        }else{
                            if (this.formEntry.orderInfo.businessType === "02") {
                                this.VinIsDisabled = true;
                                this.isEnoDisabled = true;
                                this.isCarDisabled = true;
                            } else if (this.formEntry.orderInfo.businessType === "01" && this.formEntry.orderInfo.carNature === "02") {
                                this.VinIsDisabled = true;
                                this.isEnoDisabled = true;
                            }
                        }
                        if(this.formEntry.returnRecords.length>0){
                            this.backInfo=1;
                        }

                        if (this.formEntry.orderInfo.businessType === "01") {
                            this.showInvoiceNature = false;
                        }
                        this.formEntry.custBaseInfos.forEach(en => {
                            if (Object.is(en.isLongTerm, "true")) {
                                en.isLongTerm = "是";
                            } else if (Object.is(en.isLongTerm, "false")) {
                                en.isLongTerm = "否";
                            }
                        });
                        if (this.formEntry.carInvoice.invoiceNature === "personal") {
                            this.isViewPerson = true;
                        }
                        ;
                        this.formEntry.carInvoice.invoiceAmt = res.data.invoiceAmt;
                        this.formEntry.costDetails.loanTerm = res.data.costDetails[0].loanTerm;
                        this.loanTerm = res.data.costDetails[0].loanTerm;
                        this.gpsLoanTerm = res.data.costDetails[0].loanTerm;
                        if (typeof this.formEntry.bankCard.certNo == "undefined") {
                            this.formEntry.custBaseInfos.forEach(en => {
                                    if (Object.is(en.custRole, "01")) {
                                        this.formEntry.bankCard.certNo = en.certNo;
                                    }
                                }
                            )
                        } else {
                            this.formEntry.bankCard.certNo = res.data.bankCard.certNo;
                        }
                        if (typeof res.data.gpsType === "undefined") {
                            this.isViewGps = true;
                        } else if (res.data.gpsType === "noInstall") {
                            this.formEntry.gpsInfo.gpsType = res.data.gpsType;
                            this.isViewGps = false;
                            this.isDistribute = true;
                        } else {
                            this.formEntry.gpsInfo.gpsType = res.data.gpsType;
                            this.isHaveGpsType = true;
                            this.isViewGps = true;
                        }
                        this.formEntry.financingItems.forEach(e => {
                            this.formEntry.addPriceItems.forEach(en => {
                                if (e.financeItemCode == en.financeItemCode) {
                                    e.financingItemsAmt = en.addFinanceAmt;
                                }
                            });
                        });
                        if (typeof this.formEntry.gpsInfo.houseAddressTemp === "undefined") {
                            if (typeof this.formEntry.custAddressDetails != "undefined") {
                                this.formEntry.gpsInfo.houseAddressTemp = this.formEntry.custAddressDetails.addressTemp;
                            }
                        }
                        if (typeof this.formEntry.gpsInfo.orderNo != "undefined" && this.formEntry.gpsInfo.orderNo != "") {
                            this.isDistribute = true;
                            this.isHaveGpsType = true;
                            this.isDistributeDisabled = true;
                        }
                        if (this.formEntry.insuranceInfos.length === 0) {
                            this.insuranceInfoBusiness.insuranceMode = "paper";
                            this.modelType = 1;
                            this.isInsuranceRequired = false;
                        } else {
                            this.formEntry.insuranceInfos.forEach(en => {
                                if (Object.is(en.insuranceMode, "paper")) {
                                    this.modelType = 1;
                                } else {
                                    this.modelType = 2;
                                }
                                if (Object.is(en.insuranceType, "business")) {
                                    this.insuranceInfoBusiness = deepClone(en);
                                } else if (Object.is(en.insuranceType, "compulsory")) {
                                    this.insuranceInfo = deepClone(en);
                                }
                            });
                        }
                        //已经派单成功，页面派单按钮禁用
                        if (Object.is(this.formEntry.gpsInfo.applyStatus, "success")) {
                            this.isDistributeDisabled = true;
                        }
                        if (Object.is(this.formEntry.bankCard.authorizeWay, "online")) {
                            this.isViewVer = true;
                        } else {
                            this.isViewVer = false;
                        }
                        if (Object.is(this.insuranceInfoBusiness.insuranceMode, "electronics")) {
                            this.isInsuranceRequired = true;
                        } else {
                            this.isInsuranceRequired = false;
                        }
                        if (Object.is(this.formEntry.gpsInfo.isRobberyBag, "1")) {
                            this.isViewRobberyBag = true;
                            this.isHouseAddressRequired = true;
                        } else {
                            this.isViewRobberyBag = false;
                            this.isHouseAddressRequired = false;
                        }
                        if (Object.is(this.formEntry.contractInfo.lendingMode, this.sign)) {
                            this.insuranceModeIsRequired = false;
                        } else {
                            this.insuranceModeIsRequired = true;
                        }
                        let detailed = "";
                        for (let i = 0; i < this.formEntry.financingItems.length; i++) {
                            if (Object.prototype.hasOwnProperty.call(this.formEntry.financingItems[i], "upperId") &&
                                Object.prototype.hasOwnProperty.call(this.formEntry.financingItems[i], "financeItemAmt")) {
                                detailed += this.formEntry.financingItems[i].financeItemName + "(" + this.formEntry.financingItems[i].financeItemAmt + "),";
                            }
                        }
                        this.decorationDetailed = detailed;
                    }
                });
            },
            //初始化下拉框
            initSelectData() {
                let param = ""
                param = {
                    level: '1',
                    upperCode: '1'
                };
                getLocation(param).then(res => {
                    if (res.code == "0000") {
                        res.data.forEach(item => {
                            // 表明是否是父节点
                            if (item.isParent) {
                                item.loading = false;
                                item.children = [];
                            }
                        })
                    }
                    this.initLoadData.push(...res.data);
                });
                //数据字典
                let arr = ["isDefault", "lendingMode", "gpsType", "operateWay", "bank", "insurance", "affiliatedWay", "carPurpose", "businessType", "invoiceNature","contractStatus"];
                getByTypes(arr).then(res => {
                    if (res.code === "0000") {
                        this.dataDic = deepClone(res.data);
                    }
                });
                //放款模式
                getLendingMode(this.applyNo).then(res => {
                    if (res.code === "0000") {
                        this.lendingMode.push(...res.data);
                    }
                });
                getChannelId({}).then(ress => {
                    if (ress.code === "0000") {
                        let channelId = ress.data;
                        getGpsSupplier({channelId: channelId}).then(res => {
                            if (res.code === "0000") {
                                this.quotaControlSwitch=res.data.quota[0].quotaControlSwitch;
                                if (res.data.channelBaseInfo.gpsVendorAuthor === "all") {
                                    let param = {
                                        type: "gpsSupplier",
                                    };
                                    getDictDataByType(param.type).then(res => {
                                        if (res.code == "0000") {
                                            let tempArr = [];
                                            res.data.forEach((item, index) => {
                                                let obj = {
                                                    value: item.value,
                                                    title: item.title,
                                                }
                                                tempArr.push(obj);
                                            })
                                            this.gpsSupplier = tempArr;
                                        }
                                    })
                                } else {
                                    let arr = res.data.channelBaseInfo.gpsVendorAuthor.split(",");
                                    this.initDataic(arr);
                                }
                            }
                        });
                        getQuotaListByChannelId({channelId: channelId}).then(res=>{
                            if(res.code=="0000"){
                                //签放额度
                                //先放后抵额度
                                res.data.quotaBeforeList.forEach((item,index)=>{
                                    if(item.businessType=="01"){
                                        this.newOccupied=item.occupiedQuota;
                                        this.newSurplus=item.surplusQuota;
                                        console.log("新车先抵后放额度"+item.occupiedQuota+","+item.surplusQuota);
                                    }else{
                                        this.oldOccupied=item.occupiedQuota;
                                        this.oldSurplus=item.surplusQuota;
                                        console.log("二手车先抵后放额度"+item.occupiedQuota+","+item.surplusQuota);
                                    }
                                });
                            }
                        })
                    }
                });
                //开户人
                getAccountPerson(this.applyNo).then(res => {
                    if (res.code === "0000") {
                        this.accountPerson.push(...res.data);
                    }
                });
            },
            loadData(item, callback) {
                item.loading = true;
                getLocation({upperCode: item.value}).then(res => {
                    if (res.code === "0000") {
                        res.data.forEach(function (item) {
                            if (item.isParent) {
                                item.loading = false;
                                item.children = [];
                            }
                        });
                        item.children = res.data;
                        item.loading = false;
                        callback();
                    }
                })
            },
            // 获取数据字典
            initDataic(arr) {
                let param = {
                    type: "gpsSupplier",
                };
                getDictDataByType(param.type).then(res => {
                    if (res.code == "0000") {
                        let tempArr = [];
                        res.data.forEach((item, index) => {
                            if (arr.indexOf(item.value) != "-1") {
                                let obj = {
                                    value: item.value,
                                    title: item.title,
                                }
                                tempArr.push(obj);
                            }
                        })
                        this.gpsSupplier = tempArr;
                    }
                })
            },
            editCustInfo(val) {
                console.log(val,"val-editCustInfo")
                if(val.custRole=="01"){ //主借人
                    this.contractFrontType="mainBorrowerIdcardFront";
                    this.contractBlackType="mainBorrowerIdcardBack"
                }else if(val.custRole=="02"){ //共借人
                    this.contractFrontType="comBorrowerIdcardFront";
                    this.contractBlackType="comBorrowerIdcardBack"
                }
                this.formCust = {};
                this.imgzurl="";
                this.imgfurl="";
                this.updateIndex = val._index;
                this.menuModalVisibleCust = true;
                this.isupload = true;
                let self=this;
                this.$nextTick(function(){
                    self.$refs.carUpload.resetimgurl();
                    self.$refs.carUpload.showCarImg(this.contractNo);

                })
            },
            closeCust() {
                this.menuModalVisibleCust = false;
            },
            submitCust() {
                if (this.formCust.certEndDate === "") {
                    this.$Notice.open({
                        title: '温馨提示',
                        desc: "证件有效期截止日期不能为空"
                    });
                    return false;
                }
                if (this.formCust.isLongTerm === "0" || typeof this.formCust.isLongTerm==="undefined") {
                    this.formEntry.custBaseInfos[this.updateIndex].isLongTerm = false;
                    let time = (this.formCust.certEndDate.getTime() - new Date(new Date().setHours(0, 0, 0, 0)).getTime()) / (1000 * 3600 * 24);
                    if (time <= 30) {
                        this.formEntry.custBaseInfos[this.updateIndex].isExpire = true;
                    } else {
                        this.formEntry.custBaseInfos[this.updateIndex].isExpire = false;
                    }
                } else if (this.formCust.isLongTerm === "1") {
                    this.formEntry.custBaseInfos[this.updateIndex].isLongTerm = true;
                    this.formEntry.custBaseInfos[this.updateIndex].isExpire = false;
                }
                // 影像入参数
                let imgList=this.$refs.carUpload.devierimglist();
                if(imgList.length<2){
                    this.$Message.warning("请上传身份证正反面");
                    return;
                }
                if(imgList.length>0){
                    let tempArr=[];
                    imgList.forEach((item,index)=>{
                        tempArr.push(item.map)
                    })
                    this.formEntry.custBaseInfos[this.updateIndex].contractFileVos=tempArr;
                }
                this.formEntry.custBaseInfos[this.updateIndex].certEndDate = utils.formatDate(this.getDate(this.formCust.certEndDate), 'YYYY-MM-DD');
                this.rowClassName(this.formEntry.custBaseInfos[this.updateIndex], this.updateIndex);
                this.menuModalVisibleCust = false;
            },
            save(flag) {
                this.spinShow = true;
                if (Object.is(flag, "forever")) {
                    this.isSave = 1;
                    this.$refs.formEntry.validate(valid => {
                        if (valid) {
                            let validateStatus = this.validateRule(flag);
                            if (validateStatus) {
                                this.saveBackend(flag);
                            } else {
                                this.isSave = 0;
                                this.spinShow = false;
                            }
                        } else {
                            this.spinShow = false;
                            this.isSave = 0;
                            this.$Message.error("请补全信息");
                        }
                    });
                } else {
                    this.saveBackend(flag);
                }
            },
            saveBackend(flag) {
                this.formEntry.flag = flag;
                //将applyNo填充到每个对象里
                this.formEntry.applyNo = this.applyNo;
                this.formEntry.orderInfo.applyNo = this.applyNo;
                this.formEntry.carInvoice.applyNo = this.applyNo;
                this.formEntry.gpsInfo.applyNo = this.applyNo;
                this.formEntry.gpsInfo.isRobberyBag=0;
                this.formEntry.gpsInfo.loanTerm = this.gpsLoanTerm;
                if (typeof this.formEntry.gpsInfo.preInstallTime != "undefined" && this.formEntry.gpsInfo.preInstallTime != "") {
                    this.formEntry.gpsInfo.preInstallTime = utils.formatDate(this.formEntry.gpsInfo.preInstallTime, 'YYYY-MM-DD hh:mm:ss');
                } else {
                    this.formEntry.gpsInfo.preInstallTime = "";
                }
                if (typeof this.formEntry.carInvoice.saleCertEndDate != "undefined" && this.formEntry.carInvoice.saleCertEndDate != "") {
                    this.formEntry.carInvoice.saleCertEndDate = utils.formatDate(this.formEntry.carInvoice.saleCertEndDate, 'YYYY-MM-DD hh:mm:ss');
                } else {
                    this.formEntry.carInvoice.saleCertEndDate = "";
                }
                this.formEntry.bankCard.applyNo = this.applyNo;
                this.formEntry.affiliatedUnit.applyNo = this.applyNo;
                this.formEntry.financingItems.applyNo = this.applyNo;
                this.formEntry.carDetails.applyNo = this.applyNo;
                this.formEntry.contractInfo.applyNo = this.applyNo;
                this.formEntry.orderInfo.applyNo = this.applyNo;
                this.insuranceInfo.applyNo = this.applyNo;
                this.insuranceInfoBusiness.applyNo = this.applyNo;
                this.formEntry.gpsInfo.loanTerm = this.loanTerm;
                //商业险 code
                this.insuranceInfoBusiness.insuranceType = "business";
                //交强险 code
                this.insuranceInfo.insuranceType = "compulsory";
                this.insuranceInfo.insuranceMode = this.insuranceInfoBusiness.insuranceMode;
                if (this.insuranceInfoBusiness.insuranceMode === "paper") {
                    this.formEntry.insuranceInfos[0] = this.insuranceInfoBusiness;
                    this.formEntry.insuranceInfos = [this.formEntry.insuranceInfos[0]];
                } else {
                    this.formEntry.insuranceInfos[0] = this.insuranceInfoBusiness;
                    this.formEntry.insuranceInfos[1] = this.insuranceInfo;
                }
                for(let i=0;i<this.witnessList.length;i++){
                    if(this.formEntry.contractInfo.witnessIdCard===this.witnessList[i].witnessIdCard){
                        this.formEntry.contractInfo.witnessName=this.witnessList[i].witnessName;
                    }
                }
                if(this.formEntry.carInvoice.invoiceNature==="personal"){
                    this.formEntry.carInvoice.invoiceUnit="";
                }else if(this.formEntry.carInvoice.invoiceNature==="enterprise"){
                    this.formEntry.carInvoice.saleName = "";
                    this.formEntry.carInvoice.saleCertNo = "";
                    this.formEntry.carInvoice.saleCertEndDate = "";
                    this.formEntry.carInvoice.salePhone = "";
                }
                saveToBackend(this.formEntry).then(res => {
                    this.saveLoading = true;
                    if (res.code === "0000") {
                        this.isInt = false;
                        this.$Message.success("保存成功");
                        this.saveLoading = false;
                        if(flag==="forever"){
                            this.openTabs = 'uploadInfo';
                        }
                        this.loanInfoUploadBtn();
                    } else {
                        this.$Message.error("保存失败");
                        this.saveLoading = false;
                    }
                    this.spinShow = false;
                }).catch(error => {
                    this.spinShow = false;
                    console.error(error);
                    this.saveLoading = false;
                    this.$Message.error("功能维护中，请稍后重试");
                });
            },
            setDecoration(val) {
                this.upperId = val;
                this.isDisAmt = true;
                this.menuModalVisibleDecoration = true;
            },
            cencalDecoration() {
                this.isDisAmt = false;
                this.menuModalVisibleDecoration = false;
            },
            saveDecoration() {
                let status = true;
                let amt = 0;
                let detailed = "";
                for (let i = 0; i < this.formEntry.financingItems.length; i++) {
                    if (Object.prototype.hasOwnProperty.call(this.formEntry.financingItems[i], "upperId") &&
                        this.upperId == this.formEntry.financingItems[i].upperId && !Object.prototype.hasOwnProperty.call(this.formEntry.financingItems[i], "financeItemAmt")) {
                        this.$Notice.open({
                            title: '温馨提示',
                            desc: "增融项不允许为空，请检查并将增融项填写完整后再保存！"
                        });
                        status = false;
                        break;
                    }
                    if (Object.prototype.hasOwnProperty.call(this.formEntry.financingItems[i], "upperId") && this.upperId == this.formEntry.financingItems[i].upperId) {
                        amt += Number.parseFloat(this.formEntry.financingItems[i].financeItemAmt);
                        detailed += this.formEntry.financingItems[i].financeItemName + "(" + this.formEntry.financingItems[i].financeItemAmt + "),";
                    }
                }
                if (status) {
                    for (let i = 0; i < this.formEntry.financingItems.length; i++) {
                        if (this.upperId === this.formEntry.financingItems[i].id) {
                            this.formEntry.financingItems[i].financeItemAmt = amt;
                            if( Number.parseFloat(this.formEntry.financingItems[i].financeItemAmt)<0){
                                this.$Message.error("金额不能为负数");
                                this.formEntry.financingItems[i].financeItemAmt="";
                                return;
                            }
                        }
                    }
                    this.decorationDetailed = detailed;
                    this.menuModalVisibleDecoration = false;
                    this.isDisAmt = false;
                    this.$Message.success("保存成功");
                }
            },
            //签约方式change事件
            changeVerType(val) {
                if (Object.is(val, "offline")) {
                    this.isViewVer = false;
                } else if (Object.is(val, "online")) {
                    this.isViewVer = true;
                }
            },
            //放款模式change事件
            changelendingMode(val) {
                if(!this.firstMortgage && val!=="01"){
                    this.$Message.warning("当前订单为首单，应选择先抵后放模式，请确认");
                }
                //如果是签约放款，开票单位、保险信息可以先不用填写
                if (Object.is(val, this.sign)) {
                    this.insuranceModeIsRequired = false;
                } else {
                    this.insuranceModeIsRequired = true;
                }
            },
            //是否盗抢包change事件
            changeIsRobberyBag(val) {
                let self = this;
                if (Object.is(val, "1")) {
                    this.isHouseAddressRequired = true;
                    this.isViewRobberyBag = true;
                    if (this.houseAddressTemp.length > 0) {
                        this.formEntry.gpsInfo.houseAddressTemp = this.houseAddressTemp;
                        this.formEntry.gpsInfo.houseProvince = this.houseAddressTemp[0];
                        this.formEntry.gpsInfo.houseCity = this.houseAddressTemp[1];
                        this.formEntry.gpsInfo.houseAddress = this.houseAddress;
                    } else if (Object.prototype.hasOwnProperty.call(this.formEntry, "custAddressDetails") &&
                        Object.prototype.hasOwnProperty.call(this.formEntry.custAddressDetails, "addressTemp")) {
                        this.formEntry.gpsInfo.houseAddressTemp = this.formEntry.custAddressDetails.addressTemp;
                        this.formEntry.gpsInfo.houseProvince = this.formEntry.custAddressDetails.addressTemp[0];
                        this.formEntry.gpsInfo.houseCity = this.formEntry.custAddressDetails.addressTemp[1];
                        this.formEntry.gpsInfo.houseAddress = this.formEntry.custAddressDetails.detailAddress;
                    } else {
                        this.$set(this.formEntry.gpsInfo, "houseAddressTemp", []);
                        this.formEntry.gpsInfo.houseAddress = "";
                        this.formEntry.gpsInfo.houseProvince = "";
                        this.formEntry.gpsInfo.houseCity = "";
                    }
                    this.$nextTick(() => {
                        self.formRules['gpsInfo.houseAddressTemp'] = [
                            {required: true, message: "户籍地址不能为空", trigger: "change", type: "array"}
                        ]
                    })
                } else if (Object.is(val, "0")) {
                    this.isViewRobberyBag = false;
                    this.isHouseAddressRequired = false;
                    this.houseAddressTemp = this.formEntry.gpsInfo.houseAddressTemp;
                    this.houseAddress = this.formEntry.gpsInfo.houseAddress;
                    this.$set(this.formEntry.gpsInfo, "houseAddressTemp", []);
                    this.formEntry.gpsInfo.houseAddress = "";
                    this.formEntry.gpsInfo.houseProvince = "";
                    this.formEntry.gpsInfo.houseCity = "";
                    this.$nextTick(() => {
                        self.formRules['gpsInfo.houseAddressTemp'] = []
                    })

                }
            },
            changeInvoiceNature(val) {
                if (Object.is(val, "personal")) {
                    this.isViewPerson = true;
                } else if (Object.is(val, "enterprise")) {
                    this.isViewPerson = false;
                }
            },
            //投保方式change事件
            changeInsuranceMode(val) {
                if (Object.is(val, "electronics")) {
                    this.modelType = 2;
                    this.isInsuranceRequired = true;
                } else {
                    this.modelType = 1;
                    this.isInsuranceRequired = false;
                }
            },
            //30天内过期的证件，表格给底色
            rowClassName(row, index) {
                if (row.isExpire) {
                    return 'demo-table-info-row';
                }
                return null;
            },
            businessDate() {
                // TODO yusijun 处理保险信息的结束日期不能早于开始日期，默认间隔一年，可修改的需求问题
                if (this.insuranceInfoBusiness.insuranceStartTime != "") {
                    this.insuranceInfoBusiness.insuranceEndTime = this.getTime(this.insuranceInfoBusiness.insuranceStartTime);
                }
            },
            getTime(v) {
                var year = v.getFullYear() + 1; //年 ,从 Date 对象以四位数字返回年份
                var month = v.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
                var day = v.getDate() - 1; //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
                var hours = v.getHours(); //小时 ,返回 Date 对象的小时 (0 ~ 23)
                var minutes = v.getMinutes(); //分钟 ,返回 Date 对象的分钟 (0 ~ 59)
                var seconds = v.getSeconds(); //秒 ,返回 Date 对象的秒数 (0 ~ 59)
                //修改月份格式
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                //修改日期格式
                if (day >= 0 && day <= 9) {
                    day = "0" + day;
                }
                //修改小时格式
                if (hours >= 0 && hours <= 9) {
                    hours = "0" + hours;
                }
                //修改分钟格式
                if (minutes >= 0 && minutes <= 9) {
                    minutes = "0" + minutes;
                }
                //修改秒格式
                if (seconds >= 0 && seconds <= 9) {
                    seconds = "0" + seconds;
                }
                //格式(yyyy-mm-dd hh:mm:ss)
                var currentFormatDate =
                    year +
                    "-" +
                    month +
                    "-" +
                    day +
                    " " +
                    hours +
                    ":" +
                    minutes +
                    ":" +
                    seconds;
                return currentFormatDate;
            },
            getDate(v) {
                var year = v.getFullYear(); //年 ,从 Date 对象以四位数字返回年份
                var month = v.getMonth() + 1; //月 ,从 Date 对象返回月份 (0 ~ 11) ,date.getMonth()比实际月份少 1 个月
                var day = v.getDate(); //日 ,从 Date 对象返回一个月中的某一天 (1 ~ 31)
                //修改月份格式
                if (month >= 1 && month <= 9) {
                    month = "0" + month;
                }
                //修改日期格式
                if (day >= 0 && day <= 9) {
                    day = "0" + day;
                }
                //格式(yyyy-mm-dd )
                var currentFormatDate =
                    year +
                    "-" +
                    month +
                    "-" +
                    day;
                return currentFormatDate;
            },
            //返回按钮
            returnBack() {
                this.afs.closeTab(this);
            },
            //影像件校验
            checkFileMethed() {
                this.uploadParam.busiNo = this.contractNo;
                if (this.uploadParam.busiNo != '') {
                    checkFile(this.uploadParam).then(res => {
                        if (res.code === '0000') {
                            this.imageFlag=true;
                            this.submitBusiness();
                       }
                    })
                } else {
                    this.$Message.info("温馨提示:提交前请检查是否有未录入的资料");
                }
            },

            //页面提交按钮，提交流程审批
            submitBusiness() {
                this.$refs.formEntry.validate(valid => {
                    if (valid) {
                        let validateStatus = this.validateRule("forever");
                        if (validateStatus) {
                            //去除见证人校验
                            if(typeof this.formEntry.contractInfo.witnessIdCard==="undefined" || this.formEntry.contractInfo.witnessIdCard===null || this.formEntry.contractInfo.witnessIdCard===""){
                                this.$Message.error("请在影像上传时选择见证人");
                                return;
                            }
                            if(!this.isDistribute){
                                this.$Message.error("请先派单");
                                return;
                            }
                            this.formEntry.flag = "forever";
                            //将applyNo填充到每个对象里
                            this.formEntry.applyNo = this.applyNo;
                            this.formEntry.orderInfo.applyNo = this.applyNo;
                            this.formEntry.carInvoice.applyNo = this.applyNo;
                            this.formEntry.gpsInfo.applyNo = this.applyNo;
                            this.formEntry.gpsInfo.isRobberyBag=0,
                                this.formEntry.gpsInfo.loanTerm = this.gpsLoanTerm;
                            if (typeof this.formEntry.gpsInfo.preInstallTime != "undefined" && this.formEntry.gpsInfo.preInstallTime != "") {
                                this.formEntry.gpsInfo.preInstallTime = utils.formatDate(this.formEntry.gpsInfo.preInstallTime, 'YYYY-MM-DD hh:mm:ss');
                            } else {
                                this.formEntry.gpsInfo.preInstallTime = "";
                            }
                            if (typeof this.formEntry.carInvoice.saleCertEndDate != "undefined" && this.formEntry.carInvoice.saleCertEndDate != "") {
                                this.formEntry.carInvoice.saleCertEndDate = utils.formatDate(this.formEntry.carInvoice.saleCertEndDate, 'YYYY-MM-DD hh:mm:ss');
                            } else {
                                this.formEntry.carInvoice.saleCertEndDate = "";
                            }
                            this.formEntry.bankCard.applyNo = this.applyNo;
                            this.formEntry.affiliatedUnit.applyNo = this.applyNo;
                            this.formEntry.financingItems.applyNo = this.applyNo;
                            this.formEntry.carDetails.applyNo = this.applyNo;
                            this.formEntry.contractInfo.applyNo = this.applyNo;
                            this.formEntry.orderInfo.applyNo = this.applyNo;
                            this.insuranceInfo.applyNo = this.applyNo;
                            this.insuranceInfoBusiness.applyNo = this.applyNo;
                            this.formEntry.gpsInfo.loanTerm = this.loanTerm;
                            //商业险 code
                            this.insuranceInfoBusiness.insuranceType = "business";
                            //交强险 code
                            this.insuranceInfo.insuranceType = "compulsory";
                            this.insuranceInfo.insuranceMode = this.insuranceInfoBusiness.insuranceMode;
                            if (this.insuranceInfoBusiness.insuranceMode === "paper") {
                                this.formEntry.insuranceInfos[0] = this.insuranceInfoBusiness;
                                this.formEntry.insuranceInfos = [this.formEntry.insuranceInfos[0]];
                            } else {
                                this.formEntry.insuranceInfos[0] = this.insuranceInfoBusiness;
                                this.formEntry.insuranceInfos[1] = this.insuranceInfo;
                            }
                            for(let i=0;i<this.witnessList.length;i++){
                                if(this.formEntry.contractInfo.witnessIdCard===this.witnessList[i].witnessIdCard){
                                    this.formEntry.contractInfo.witnessName=this.witnessList[i].witnessName;
                                }
                            }
                            let loanAllMoney=0;
                            for(let i=0;i<this.formEntry.costDetails.length;i++){
                                loanAllMoney+=this.formEntry.costDetails[i].loanAmt;
                            }
                            console.log(this.quotaControlSwitch);
                            if(this.quotaControlSwitch==='1') {
                                if (this.formEntry.contractInfo.lendingMode === "02") {
                                    if (this.formEntry.orderInfo.businessType === "01") {
                                        if (loanAllMoney > this.newSurplus) {
                                            this.$Modal.confirm({
                                                title: "新车先放后抵额度不足，是否确认提交？",
                                                onOk: () => {
                                                    this.spinShow = true;
                                                    saveToBackend(this.formEntry).then(res => {
                                                        if (res.code === "0000") {
                                                            // this.contractNo = res.data;
                                                            let param = {
                                                                applyNo: this.applyNo,
                                                                contractNo: this.contractNo,
                                                                submitFlag:this.contractStatus,
                                                                userRelName:this.userRelName,
                                                                phone:this.phone
                                                            };
                                                            loanApplySubmitInfo(param).then(result => {
                                                                if (result.code === "0000") {
                                                                    this.$Message.success("申请成功");
                                                                    this.spinShow = false;
                                                                    this.afs.closeTab(this);
                                                                }
                                                            });
                                                        } else {
                                                            this.spinShow = false;
                                                            this.$Message.error("保存失败");
                                                        }
                                                    }).catch(error => {
                                                        this.spinShow = false;
                                                        console.error(error);
                                                        this.$Message.error("功能维护中，请稍后重试");
                                                    });
                                                }
                                            });
                                            // this.$Message.error("新车业务贷款金额不足");
                                        }else{
                                            this.spinShow = true;
                                            saveToBackend(this.formEntry).then(res => {
                                                if (res.code === "0000") {
                                                    // this.contractNo = res.data;
                                                    let param = {
                                                        applyNo: this.applyNo,
                                                        contractNo: this.contractNo,
                                                        submitFlag:this.contractStatus,
                                                        userRelName:this.userRelName,
                                                        phone:this.phone
                                                    };
                                                    loanApplySubmitInfo(param).then(result => {
                                                        if (result.code === "0000") {
                                                            this.$Message.success("申请成功");
                                                            this.spinShow = false;
                                                            this.afs.closeTab(this);
                                                        }
                                                    });
                                                } else {
                                                    this.spinShow = false;
                                                    this.$Message.error("保存失败");
                                                }
                                            }).catch(error => {
                                                this.spinShow = false;
                                                console.error(error);
                                                this.$Message.error("功能维护中，请稍后重试");
                                            });
                                        }
                                    } else {
                                        if (loanAllMoney > this.oldSurplus) {
                                            this.$Modal.confirm({
                                                title: "二手车先放后抵额度不足，是否确认提交？",
                                                onOk: () => {
                                                    this.spinShow = true;
                                                    saveToBackend(this.formEntry).then(res => {
                                                        if (res.code === "0000") {
                                                            // this.contractNo = res.data;
                                                            let param = {
                                                                applyNo: this.applyNo,
                                                                contractNo: this.contractNo,
                                                                submitFlag:this.contractStatus,
                                                                userRelName:this.userRelName,
                                                                phone:this.phone
                                                            };
                                                            loanApplySubmitInfo(param).then(result => {
                                                                if (result.code === "0000") {
                                                                    this.$Message.success("申请成功");
                                                                    this.spinShow = false;
                                                                    this.afs.closeTab(this);
                                                                }
                                                            });
                                                        } else {
                                                            this.spinShow = false;
                                                            this.$Message.error("保存失败");
                                                        }
                                                    }).catch(error => {
                                                        this.spinShow = false;
                                                        console.error(error);
                                                        this.$Message.error("功能维护中，请稍后重试");
                                                    });
                                                }
                                            });
                                            // this.$Message.error("二手车贷款金额不足");
                                        }else{
                                            this.spinShow = true;
                                            saveToBackend(this.formEntry).then(res => {
                                                if (res.code === "0000") {
                                                    // this.contractNo = res.data;
                                                    let param = {
                                                        applyNo: this.applyNo,
                                                        contractNo: this.contractNo,
                                                        submitFlag:this.contractStatus,
                                                        userRelName:this.userRelName,
                                                        phone:this.phone
                                                    };
                                                    loanApplySubmitInfo(param).then(result => {
                                                        if (result.code === "0000") {
                                                            this.$Message.success("申请成功");
                                                            this.spinShow = false;
                                                            this.afs.closeTab(this);
                                                        }
                                                    });
                                                } else {
                                                    this.spinShow = false;
                                                    this.$Message.error("保存失败");
                                                }
                                            }).catch(error => {
                                                this.spinShow = false;
                                                console.error(error);
                                                this.$Message.error("功能维护中，请稍后重试");
                                            });
                                        }
                                    }
                                }else{
                                    this.spinShow = true;
                                    saveToBackend(this.formEntry).then(res => {
                                        if (res.code === "0000") {
                                            // this.contractNo = res.data;
                                            let param = {
                                                applyNo: this.applyNo,
                                                contractNo: this.contractNo,
                                                submitFlag:this.contractStatus,
                                                userRelName:this.userRelName,
                                                phone:this.phone
                                            };
                                            loanApplySubmitInfo(param).then(result => {
                                                if (result.code === "0000") {
                                                    this.$Message.success("申请成功");
                                                    this.spinShow = false;
                                                    this.afs.closeTab(this);
                                                }
                                            });
                                        } else {
                                            this.spinShow = false;
                                            this.$Message.error("保存失败");
                                        }
                                    }).catch(error => {
                                        this.spinShow = false;
                                        console.error(error);
                                        this.$Message.error("功能维护中，请稍后重试");
                                    });
                                }
                            }else{
                                this.spinShow = true;
                                saveToBackend(this.formEntry).then(res => {
                                    if (res.code === "0000") {
                                        // this.contractNo = res.data;
                                        let param = {
                                            applyNo: this.applyNo,
                                            contractNo: this.contractNo,
                                            submitFlag:this.contractStatus,
                                            userRelName:this.userRelName,
                                            phone:this.phone
                                        };
                                        loanApplySubmitInfo(param).then(result => {
                                            if (result.code === "0000") {
                                                this.$Message.success("申请成功");
                                                this.spinShow = false;
                                                this.afs.closeTab(this);
                                            }
                                        });
                                    } else {
                                        this.spinShow = false;
                                        this.$Message.error("保存失败");
                                    }
                                }).catch(error => {
                                    this.spinShow = false;
                                    console.error(error);
                                    this.$Message.error("功能维护中，请稍后重试");
                                });
                            }
                        } else {
                            this.spinShow = false;
                        }
                    } else {
                        this.spinShow = false;
                        this.$Message.error("请补全信息");
                    }
                });
            },
            downloadFile() {
                this.contractBatchPrint();
                // this.templateModel = true;
            },
            //派单按钮
            distribute() {
                if(typeof this.formEntry.gpsInfo.gpsSupplier==="undefined" || this.formEntry.gpsInfo.gpsSupplier===""){
                    this.$Message.error("请选择GPS厂商");
                    return;
                }
                if(typeof this.formEntry.gpsInfo.siteContact==="undefined" || this.formEntry.gpsInfo.siteContact===""){
                    this.$Message.error("请填写现场联系人");
                    return;
                }
                if(typeof this.formEntry.gpsInfo.contactPhone==="undefined" || this.formEntry.gpsInfo.contactPhone===""){
                    this.$Message.error("请填写联系电话");
                    return;
                }else if(!applyUtils.isPhone(this.formEntry.gpsInfo.contactPhone)){
                    this.$Message.error("请填写正确的联系电话");
                    return;
                }
                if(typeof this.formEntry.gpsInfo.preInstallTime==="undefined" || this.formEntry.gpsInfo.preInstallTime==="" ){
                    this.$Message.error("请填写安装时间");
                    return;
                }
                if(typeof this.formEntry.gpsInfo.installAddressTemp==="undefined"|| this.formEntry.gpsInfo.installAddressTemp===""){
                    this.$Message.error("请选择安装省市");
                    return;
                }
                if(typeof this.formEntry.gpsInfo.installAddress==="undefined" || this.formEntry.gpsInfo.installAddress===""){
                    this.$Message.error("请填写安装地址");
                    return;
                }
                this.formEntry.gpsInfo.loanTerm = this.gpsLoanTerm;
                this.formEntry.gpsInfo.isRobberyBag=0,
                this.formEntry.gpsInfo.carVin = this.formEntry.carDetails.carVin;
                this.formEntry.gpsInfo.carId = this.formEntry.carDetails.id;
                this.formEntry.gpsInfo.contractNo = this.contractNo;
                this.formEntry.gpsInfo.applyNo = this.applyNo;
                this.spinShow = true;
                distribute(this.formEntry.gpsInfo).then(res => {
                    this.distributeLoading = true;
                    if (res.code === "0000") {
                        this.spinShow = false;
                        this.$Message.success(res.msg);
                        this.distributeLoading = false;
                        this.isDistribute = true;
                        this.isDistributeDisabled = true;
                    } else if (res.code === "9999") {
                        this.$Message.error(res.msg);
                        this.spinShow = true;
                        this.distributeLoading = false;
                    }
                }).catch(error => {
                    console.log(error);
                    this.spinShow = false;
                    this.distributeLoading = false;
                });
            },
            getPhoneCode() {
                if(this.formEntry.bankCard.bankPhone===""){
                    this.$Message.error("预留手机号不能为空");
                    return;
                }
                let myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
                if (!myreg.test(this.formEntry.bankCard.bankPhone)) {
                    this.$Message.error("预留手机号格式不正确");
                    return;
                }
                if(this.formEntry.bankCard.accountNo===""){
                    this.$Message.error("还款账号不能为空");
                    return;
                }
                if(this.formEntry.bankCard.certNo===""){
                    this.$Message.error("开户人不能为空");
                    return;
                }
                if(this.formEntry.bankCard.bankCode===""){
                    this.$Message.error("银行名称不能为空");
                    return;
                }
                let name="";
                for(let i=0;i<this.accountPerson.length;i++){
                    if(this.formEntry.bankCard.certNo===this.accountPerson[i].certNo){
                        name=this.accountPerson[i].custName;
                    }
                }
                let params={
                    applyNo:this.applyNo,
                    contractNo:this.contractNo,
                    tel:this.formEntry.bankCard.bankPhone,
                    payAcctNo:this.formEntry.bankCard.accountNo,
                    chlCd:this.formEntry.bankCard.bankCode,
                    cardNo:this.formEntry.bankCard.certNo,
                    payAcctNm:name
                }
                doVerify(params).then(res=>{
                    if(res.code==="0000"){
                        this.$Message.success("短信验证码发送成功");
                    }
                })
            },
            selectCheck(value) {
                if (value) {
                    this.formCust.isLongTerm = "1";
                    this.formCust.certEndDate = `${9999}/${12}/${31}`;
                } else {
                    this.formCust.isLongTerm = "0";
                    this.formCust.certEndDate = "";
                }
            },
            conform() {
                if(this.formEntry.bankCard.bankPhone===""){
                    this.$Message.error("预留手机号不能为空");
                    return;
                }
                let myreg = /^[1][3,4,5,7,8][0-9]{9}$/;
                if (!myreg.test(this.formEntry.bankCard.bankPhone)) {
                    this.$Message.error("预留手机号格式不正确");
                    return;
                }
                if(this.formEntry.bankCard.accountNo===""){
                    this.$Message.error("还款账号不能为空");
                    return;
                }
                if(this.formEntry.bankCard.certNo===""){
                    this.$Message.error("开户人不能为空");
                    return;
                }
                if(this.formEntry.bankCard.bankCode===""){
                    this.$Message.error("银行名称不能为空");
                    return;
                }
                let name="";
                for(let i=0;i<this.accountPerson.length;i++){
                    if(this.formEntry.bankCard.certNo===this.accountPerson[i].certNo){
                        name=this.accountPerson[i].custName;
                    }
                }
                let params={
                    applyNo:this.applyNo,
                    contractNo:this.contractNo,
                    tel:this.formEntry.bankCard.bankPhone,
                    payAcctNo:this.formEntry.bankCard.accountNo,
                    chlCd:this.formEntry.bankCard.bankCode,
                    cardNo:this.formEntry.bankCard.certNo,
                    payAcctNm:name,
                    vc:this.formEntry.bankCard.verCode
                }
                signBank(params).then(res=>{
                    if(res.code==="0000"){
                        this.$Message.success("短信验证码验证成功");
                    }
                })
            },
            //表单提交前校验
            validateRule() {
                if (this.isViewVer && !Object.prototype.hasOwnProperty.call(this.formEntry.bankCard, "verCode")) {
                    this.$Message.error("银行卡电子签署,必须填写银行预留手机号与验证码");
                    return false;
                }
                // if(!this.isDistribute){
                //     this.$Notice.open({
                //         title: '温馨提示',
                //         desc: "请先派单"
                //     });
                //     return false;
                // }
                //如果不是签约放款，则必须选择投保方式
                if (!Object.is(this.formEntry.contractInfo.lendingMode, this.sign) &&
                    (!Object.prototype.hasOwnProperty.call(this.insuranceInfoBusiness, "insuranceMode") ||
                        Object.is(this.insuranceInfoBusiness.insuranceMode, "") ||
                        Object.is(this.insuranceInfoBusiness.insuranceMode, undefined))) {
                    this.$Message.error("请选择投保方式");
                    return false;
                }
                let arr = ["insuranceCompany", "insuranceNo"];
                // let arr = ["insuranceCompany","insuranceNo","insuranceStartTime","insuranceEndTime"];
                if (Object.is(this.insuranceInfoBusiness.insuranceMode, "electronics")) {
                    for (let i = 0; i < arr.length; i++) {
                        if (!Object.prototype.hasOwnProperty.call(this.insuranceInfo, arr[i])) {
                            this.$Message.error("投保方式为电子保单，保险信息必须填写，请检查填写后再保存");
                            return false;
                            break;
                        }
                        if (!Object.prototype.hasOwnProperty.call(this.insuranceInfoBusiness, arr[i])) {
                            this.$Message.error("投保方式为电子保单，保险信息必须填写，请检查填写后再保存");
                            return false;
                            break;
                        }
                    }
                }
                if (Object.is(this.insuranceInfoBusiness.insuranceMode, "paper")) {
                    if (this.insuranceInfoBusiness.insuranceStartTime === "") {
                        this.$Message.error("投保方式为纸质保单，保险信息必须填写，请检查填写后再保存");
                        return false;
                    }
                    if (this.insuranceInfoBusiness.insuranceEndTime === "") {
                        this.$Message.error("投保方式为纸质保单，保险信息必须填写，请检查填写后再保存");
                        return false;
                    }
                    let oDate1 = new Date(this.insuranceInfoBusiness.insuranceStartTime);
                    let oDate2 = new Date(this.insuranceInfoBusiness.insuranceEndTime);
                    if (this.insuranceInfoBusiness.insuranceStartTime.length != 19) {
                        this.insuranceInfoBusiness.insuranceStartTime = utils.formatDate(this.getDate(this.insuranceInfoBusiness.insuranceStartTime), 'YYYY-MM-DD hh:mm:ss');
                    }
                    if (this.insuranceInfoBusiness.insuranceEndTime.length != 19) {
                        this.insuranceInfoBusiness.insuranceEndTime = utils.formatDate(this.getDate(this.insuranceInfoBusiness.insuranceEndTime), 'YYYY-MM-DD hh:mm:ss');
                    }
                    if (oDate1.getTime() > oDate2.getTime()) {
                        this.$Message.error("商业险的开始日期不能早于结束日期");
                        return false;
                    }
                }
                if (Object.is(this.formEntry.orderInfo.affiliatedWay, '02')) {
                    if (!Object.prototype.hasOwnProperty.call(this.formEntry.affiliatedUnit, "affiliatedName")
                        || !Object.prototype.hasOwnProperty.call(this.formEntry.affiliatedUnit, "socUniCrtCode")) {
                        this.$Message.error("请填写挂靠信息");
                        return false;
                    }
                }

                for (let i = 0; i < this.formEntry.financingItems.length; i++) {
                    if (this.formEntry.financingItems[i].financeItemAmt==="" || typeof this.formEntry.financingItems[i].financeItemAmt==="undefined") {
                        this.$Message.error("请填写附加贷金额");
                        return false;
                    }
                    if (Number.parseFloat(this.formEntry.financingItems[i].financeItemAmt)<0) {
                        this.$Message.error("附加金额不能为负数");
                        return false;
                    }
                }
                let custs = this.formEntry.custBaseInfos;
                let custFlag = false;
                for (let j = 0; j < custs.length; j++) {
                    let day1 = new Date(custs[j].certEndDate);
                    let day2 = new Date();
                    let day = (day1 - day2) / (1000 * 60 * 60 * 24);
                    if (day < 0) {
                        custFlag = true;
                        if (custFlag) {
                            this.$Message.error(custs[j].custName + "身份证到期，请更改身份证信息后再保存");
                            return false;
                        }
                    }
                }

                return true;
            },
            handleCheckAll() {
                if (this.indeterminate) {
                    this.checkAll = false;
                } else {
                    this.checkAll = !this.checkAll;
                }
                this.indeterminate = false;
                if (this.checkAll) {
                    let codeList = this.fileList.map((item, index) => {
                        return item.attachmentCode;
                    })
                    this.checkAllGroup = codeList;
                } else {
                    this.checkAllGroup = [];
                }
            },
            checkAllGroupChange(data) {
                if (data.length === this.fileList.length) {
                    this.indeterminate = false;
                    this.checkAll = true;
                } else if (data.length > 0) {
                    this.indeterminate = true;
                    this.checkAll = false;
                } else {
                    this.indeterminate = false;
                    this.checkAll = false;
                }
            },
            openTree() {
                this.getTreeDate();
                this.aa = 1;
            },
            closeTree(){
                this.aa=0;
            },
            search() {
                // 搜索树
                this.treeData=[];
                if (this.formEntry.carInvoice.invoiceUnit) {
                    this.treeLoading = true;
                    let params={channelId:this.channelId,drawerPartyName:this.formEntry.carInvoice.invoiceUnit}
                    getdrawerParty(params).then(res => {
                        if(res.data.length>0){
                            for(let i=0;i<res.data.length;i++){
                                let invoiceUnit={"title":res.data[i].drawerPartyName}
                                this.treeData.push(invoiceUnit);
                            }
                        }else{
                            this.treeData=[];
                        }
                    })
                } else {
                    // 为空重新加载
                    this.getTreeDate();
                }
            },
            selectTree(v) {
                if (v.length > 0) {
                    // 转换null为""
                    for (let attr in v[0]) {
                        if (v[0][attr] === null) {
                            v[0][attr] = "";
                        }
                    }
                    let str = JSON.stringify(v[0]);
                    let data = JSON.parse(str);
                    this.formEntry.carInvoice.invoiceUnit = data.title;
                    this.aa = 0;
                }
            },
            getTreeDate(){
                this.treeData=[];
                getChannelId({}).then(ress => {
                    if (ress.code === "0000") {
                        let channelId = ress.data;
                        this.channelId=channelId;
                        let params={channelId:channelId}
                        getdrawerParty(params).then(res => {
                            if(res.data.length>0){
                                for(let i=0;i<res.data.length;i++){
                                    let invoiceUnit={"title":res.data[i].drawerPartyName}
                                    this.treeData.push(invoiceUnit);
                                }
                            }else{
                                this.treeData=[];
                            }
                        })
                    }
            });
            },
            changeGpsSupplier(v){
                if(!this.formEntry.gpsInfo.gpsType){
                    this.$Message.error("请选择GPS型号");
                    return;
                }
                let params={
                    gpsFirm:v,
                    gpsType:this.formEntry.gpsInfo.gpsType,
                    downTerm:this.formEntry.costDetails.loanTerm
                }
                getGpsFullName(params).then(res =>{
                    if(res.code==='0000'){
                        if(typeof res.data.gpsFullName!=="undefined"){
                            this.gpsFullName=res.data.gpsFullName;
                        }
                    }
                })
            },
            turnToUpload(name){
                this.openTabs = name;
                if(name==='uploadInfo' && this.saveFlag==='0'){
                    this.save('temp');
                }else{
                    this.loanInfoUploadBtn();
                }
            }
        }
    }

</script>


